UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NTy7tmNQF5SlMwa1Lqpf+aS0cbETS3gFeJKGaDUMR9Q=' 
WHERE 
  key_id = '8b3411fb0ae38fd5730510413771f3b2062a9c14aa35a3be789f86dcee1c9e93' 
  AND (
    token = 'NTy7tmNQF5SlMwa1Lqpf+aS0cbETS3gFeJKGaDUMR9Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044