UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KrQAsUhQQFp+ROHltioeRa4+59kn5Nub88PUFT5U6fU=' 
WHERE 
  key_id = '76aea5fa6c99b532ff5f19db381137843ba699c7a5ba6db4442c98e4f600e178' 
  AND (
    token = 'KrQAsUhQQFp+ROHltioeRa4+59kn5Nub88PUFT5U6fU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00067