UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2yXT0iEVUEyM8dgJuNJId61Q2ecrRvCIK80xHI6pRRA='
WHERE
key_id = '3e7c532f274fd2cf356dcb71e57d36b88226d505452df588c37762355098a628'
AND (
token = '2yXT0iEVUEyM8dgJuNJId61Q2ecrRvCIK80xHI6pRRA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)