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