UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HfO3CvdLwn0gL38aU9gki17q7DYPvtzhaBh7a6WRkr4=' 
WHERE 
  key_id = '69d77d519503a0003c0c5935425fab34ae5ac823333f66febcfce5d8a7a5529f' 
  AND (
    token = 'HfO3CvdLwn0gL38aU9gki17q7DYPvtzhaBh7a6WRkr4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026