UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bL0nvcx/r6GasTCs6vQ7qOdNAElIY6YYyE0ckmfJQxc=' 
WHERE 
  key_id = '4c9e140e34fa352ca4ed5d8aee0f455f68f24c0b8ee097e655aa193488ffc6d1' 
  AND (
    token = 'bL0nvcx/r6GasTCs6vQ7qOdNAElIY6YYyE0ckmfJQxc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055