UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rlJCXfoRSqyV5VhZIl3eaN8ri/PZ4kdO9pt4bxYYoec='
WHERE
key_id = 'be1d5434d384c4dbd8254060644e0859ed11286f362e579158d472dd9f542351'
AND (
token = 'rlJCXfoRSqyV5VhZIl3eaN8ri/PZ4kdO9pt4bxYYoec='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)