UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Lsn+zqUdU3aKlO9LeVdMsdHQlbW2mgXxTf8UK5q9AfI=' 
WHERE 
  key_id = 'ba90a6b5ee6b741e6d2a3e537de0d67a2f6596364e54b6b7e61d9ecaee2ed229' 
  AND (
    token = 'Lsn+zqUdU3aKlO9LeVdMsdHQlbW2mgXxTf8UK5q9AfI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017