UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xleovik+gxj5p8EIlzC8/+XkclhH1V8e4tTn9reErxk=' 
WHERE 
  key_id = '515bf1283e02593cb9c99ccf5ee33c44a372fd9c1b3714289e4d1fb4c4f497a3' 
  AND (
    token = 'xleovik+gxj5p8EIlzC8/+XkclhH1V8e4tTn9reErxk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042