UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CThNVhv8/xAaHTlPmauZfOZ4OEn+/gTIxU3vOsViQ1w=' 
WHERE 
  key_id = 'fa032f4598de9b940a943b9e3af1305101e43350f67ccca59b933eefed127e04' 
  AND (
    token = 'CThNVhv8/xAaHTlPmauZfOZ4OEn+/gTIxU3vOsViQ1w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037