UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '+RDzuJwH00UN2IhU9Dtivfont5lNwDHVtQaMt2W67MU='
WHERE
key_id = 'd4b57732429ed90000588239ebaf9b63e7b327b866c3fcc95f743c8f3a38ab24'
AND (
token = '+RDzuJwH00UN2IhU9Dtivfont5lNwDHVtQaMt2W67MU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)