UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1J4q/KulpTO1B75kIsMh77s9d+bH8mSP8scvXDzx74U=' 
WHERE 
  key_id = 'd168834533eba56170fac15c5aefc46562da896f0c1d47544f6c3d076c310e66' 
  AND (
    token = '1J4q/KulpTO1B75kIsMh77s9d+bH8mSP8scvXDzx74U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016