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

Query time 0.00023