UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NpSUuf0GxiwS44eK8Bo2EC1CPmsVgPfRMEALZ14+Gp0='
WHERE
key_id = 'dc2b9c85e46320ce9df6a60f550c9f7fb74deb8f00f30b1994735f4b4ea89b18'
AND (
token = 'NpSUuf0GxiwS44eK8Bo2EC1CPmsVgPfRMEALZ14+Gp0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)