UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sgu0nYkiXUprjgd7YNB+PMatsIH7lP91T68eIZfh8mA=' 
WHERE 
  key_id = '3c162086a31a9d495d37f068dcedba80a553db01218f1a91e81bf62df348be93' 
  AND (
    token = 'sgu0nYkiXUprjgd7YNB+PMatsIH7lP91T68eIZfh8mA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047