UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VBvR9Lop87VsKjCeYAYnG2niMILE+01pKUcpWFIP0u8=' 
WHERE 
  key_id = 'c308314ec3751b4a3512420965db3bf48151bfdb2e9e1d90e2df05073720fc77' 
  AND (
    token = 'VBvR9Lop87VsKjCeYAYnG2niMILE+01pKUcpWFIP0u8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016