UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'A4HLYIs4ePN4Bj+6oX4pIh+E2fCP0BBrYszIapjt2BU=' 
WHERE 
  key_id = 'b7525fee2fc1aa519df75837ca55fc5cecf00db89f98854b40466b4c3abadaac' 
  AND (
    token = 'A4HLYIs4ePN4Bj+6oX4pIh+E2fCP0BBrYszIapjt2BU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028