UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'M+r2tE4NCbmCvz6L47O+10W83UQzREwKQIMXbyE7jNA=' 
WHERE 
  key_id = '14a80b0b8328b9605e9035ccfbac5ca38a46861dfe5c693364591ccf5ac2474f' 
  AND (
    token = 'M+r2tE4NCbmCvz6L47O+10W83UQzREwKQIMXbyE7jNA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029