UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'a/ELvQaosSWf9mPmBnifd1CrJjXfiebILMPx9CEOWJU='
WHERE
key_id = 'c987d6f962e6e299bf3c21e10b386a74c04e637174ebcae9b5b5afd1360cb525'
AND (
token = 'a/ELvQaosSWf9mPmBnifd1CrJjXfiebILMPx9CEOWJU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)