UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5lur7msNw0uRQVgBwUoCfeAvtFHGFJZipNvA77UPYYg=' 
WHERE 
  key_id = 'df43b53c8ed36b55b574a85e1543b4637a6532f9ebc57536dac8f3d84c56e8d5' 
  AND (
    token = '5lur7msNw0uRQVgBwUoCfeAvtFHGFJZipNvA77UPYYg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037