UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wmIN2135v3fjeVPthlBgjGw5+tdjrC6pF1ChF+rOX+g='
WHERE
key_id = 'fd5e6b1794bbbfd791af8f9547593c33e99dfc33ea485091315c37e4810dd3a3'
AND (
token = 'wmIN2135v3fjeVPthlBgjGw5+tdjrC6pF1ChF+rOX+g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)