UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ABqFNiU45Ad9bcxKETA57cjeFJGas/CFGEWMGHMK0WI='
WHERE
key_id = '4f39461f1b8db8472278aa87e48bc910fbdc49a300e55d1d535f0cd85a327ef0'
AND (
token = 'ABqFNiU45Ad9bcxKETA57cjeFJGas/CFGEWMGHMK0WI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)