UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'P0e/hEN8fafPSfZazN6w2VAEWlcaDOki9NpE9zslzSE='
WHERE
key_id = '50b821066fb592f1cb749cb43358e9879cfda8fab92751959c5745d7f66f827e'
AND (
token = 'P0e/hEN8fafPSfZazN6w2VAEWlcaDOki9NpE9zslzSE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)