UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cjFpvDXrQ5neYBit3s2HD7HBt2raTzs4v/2px0oiHh0='
WHERE
key_id = 'e067acbdd3af9f07a4c3b184f776e0816e6c33ef7127fceae44e89da71d5896b'
AND (
token = 'cjFpvDXrQ5neYBit3s2HD7HBt2raTzs4v/2px0oiHh0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)