UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OCnAGksvdGZsU2WTZ3l652gJlxXy+jDlOdNaiqVAVHs=' 
WHERE 
  key_id = '596ba522bf0700e348aa74afee999b5d91cbfa44dbb9786fdd430bc54853ab84' 
  AND (
    token = 'OCnAGksvdGZsU2WTZ3l652gJlxXy+jDlOdNaiqVAVHs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018