UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qrTmi/1WeAI+ZnVvc0UTl1qK5fgdAqAjvafoY8D8ORk=' 
WHERE 
  key_id = '5ca3afaf7d31838c0b5a47b57894af68f929a6037de79398ac3d7150541e1f4f' 
  AND (
    token = 'qrTmi/1WeAI+ZnVvc0UTl1qK5fgdAqAjvafoY8D8ORk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018