UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UZqyOmF6n/0YloQpmx9QyEbuEWH1Fmkaj4cWy2WocIA='
WHERE
key_id = 'ddd3a90ac7bb666f09ed20e3feb1508b3d5a185a119cd5fb328a57c7007ba4c0'
AND (
token = 'UZqyOmF6n/0YloQpmx9QyEbuEWH1Fmkaj4cWy2WocIA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)