UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '/S6HPABR5wnuKltO0QLyq5JyWbTdXgkHVZiBF/M1euw='
WHERE
key_id = 'c87c40dcb02c573672d381b433abd8d6d771bec0f633d5a9a82e0aa78d6e76ec'
AND (
token = '/S6HPABR5wnuKltO0QLyq5JyWbTdXgkHVZiBF/M1euw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)