UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bMI5/lGm+kkVsruUlfoAsgvQjlt2n2KOl4reiQEa9vU='
WHERE
key_id = 'cb33d0d3e09c298ea7c4270291c2c76d0f39d4dc87f8d6910aee969667808669'
AND (
token = 'bMI5/lGm+kkVsruUlfoAsgvQjlt2n2KOl4reiQEa9vU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)