UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '+3fHjoW4CVRQoI0dWJlSJKsO2paJK7v6nIt67UOZJjs='
WHERE
key_id = 'b31d46db6458299c57d3c1fb2de0504398f249c26208292ded52390cf72fc244'
AND (
token = '+3fHjoW4CVRQoI0dWJlSJKsO2paJK7v6nIt67UOZJjs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)