UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'McqjLRFtpELPpwsFij4+CHbMx4NDti/ECq1tSf9gYqQ=' 
WHERE 
  key_id = '06a9a60c110b181884690bb051227da05c9798e360d81951a08c57017f9d2911' 
  AND (
    token = 'McqjLRFtpELPpwsFij4+CHbMx4NDti/ECq1tSf9gYqQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00060