UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'skZ8nSTOH/PGf7djevclDCf9y5rxWcE82v0QeW3J34s=' 
WHERE 
  key_id = '866c7ed37b9b8d54456a49edd59a9c588d3db06d5b7b9d83fb54f364044f7894' 
  AND (
    token = 'skZ8nSTOH/PGf7djevclDCf9y5rxWcE82v0QeW3J34s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034