UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4g+6kNA4VPalnt8RRFuER3V3UpdHV2g50CtXIfpnMRk='
WHERE
key_id = 'a150edd886ee2516fdbeab92698ac082fa1d8d60736de7e6ff3c4c2a8748613e'
AND (
token = '4g+6kNA4VPalnt8RRFuER3V3UpdHV2g50CtXIfpnMRk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)