UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'whzrw/HrI6qDEyXCbJwqUVwW3j0s1i/39RalQ1c4ewg=' 
WHERE 
  key_id = 'dd88f5887b02cce2d20e21a10af3a960197dd2d152475c983b83836c34de2116' 
  AND (
    token = 'whzrw/HrI6qDEyXCbJwqUVwW3j0s1i/39RalQ1c4ewg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026