UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 't++UmsETNn5u++R//B4Rn9i/xM1VyK49hW4NPkz+61w=' 
WHERE 
  key_id = 'c5821dc09093503b925eee53518fc7c3d81eb3013835ce7600110c5ed8c75272' 
  AND (
    token = 't++UmsETNn5u++R//B4Rn9i/xM1VyK49hW4NPkz+61w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019