UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GOFwH3zynb6F7CGKCzl28VLADVean8LOUAoOrs74Fqo=' 
WHERE 
  key_id = 'a4c64d68ea5e7b25fca0d140367ef793a3f0b60a9a2d46efb892c4d2b31a7970' 
  AND (
    token = 'GOFwH3zynb6F7CGKCzl28VLADVean8LOUAoOrs74Fqo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042