UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yDyeOtfURfhWgCpnDMiYAIllWt8SbKS7e2neMGJYOqs=' 
WHERE 
  key_id = 'ad1a560165a5075c556a76e00f3c2ed377c50b5c4252c48f102dd8f539e88f5b' 
  AND (
    token = 'yDyeOtfURfhWgCpnDMiYAIllWt8SbKS7e2neMGJYOqs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026