UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cXM6XxL46DFo2gBBm8SWzRsEA7Tph00wyvfiTvZeHIU=' 
WHERE 
  key_id = '670a6e622bd034e38c0052a8b1ffa4acf28d37ca116ef7fbf5c5c7e009727c8e' 
  AND (
    token = 'cXM6XxL46DFo2gBBm8SWzRsEA7Tph00wyvfiTvZeHIU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032