UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YvQhlei3XiJGnNY+yKaGmItF6oX8ePZbnJqTxGHQXO8='
WHERE
key_id = '1400736cf50b543fdf8969234cbaa3171c9b8c810dedade3d991ab5df38aba9b'
AND (
token = 'YvQhlei3XiJGnNY+yKaGmItF6oX8ePZbnJqTxGHQXO8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)