UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xOfoybyCehWYACqQVGT72184rp8vxkrOabjaDPlkwMU=' 
WHERE 
  key_id = '27d48561e95b22cf19551684ecd801c1c2fec98ef91ecb7f515d588b6e5d7044' 
  AND (
    token = 'xOfoybyCehWYACqQVGT72184rp8vxkrOabjaDPlkwMU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021