UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ADym3QAPQ6OegFa52U2geRdPWGkZC1cee6HQPLPsbJc='
WHERE
key_id = '7b5614bd08d5b534dde8343ae48eb8ca54e52e7485b82d633b5eeb45209b4d76'
AND (
token = 'ADym3QAPQ6OegFa52U2geRdPWGkZC1cee6HQPLPsbJc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)