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

Query time 0.00031