UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N+UjlUttv/aXArcWG6ylpYAZtIANfdcd9e+zcAAcyY8=' 
WHERE 
  key_id = '970fb60591b9a4b65ba41eed953d93e0590bcfd6626ead00186a0fefeb949f0b' 
  AND (
    token = 'N+UjlUttv/aXArcWG6ylpYAZtIANfdcd9e+zcAAcyY8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036