UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aqMD/yGv0xUqqHjUs5BszD5OOJdANrQSmJScOgB6/Y0='
WHERE
key_id = '5983782835a72f0241062b2b82d8c453ccf45bca8295f9c03106930432b1f6f2'
AND (
token = 'aqMD/yGv0xUqqHjUs5BszD5OOJdANrQSmJScOgB6/Y0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)