UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6XQKl2i3uNHEsYeNhqcAsivTV6n9d1xxiVihIjP9RpE='
WHERE
key_id = '06d0a83bf568aadd34f18e615e45274ed39f71336e3a6053cd60e7d8351492fe'
AND (
token = '6XQKl2i3uNHEsYeNhqcAsivTV6n9d1xxiVihIjP9RpE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)