UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sOdcCQ0aBlS5HDhQcusLDiISFNGwH4ltDukSCltLD48='
WHERE
key_id = '2f3f4d6c1fff308648efd51babc670f861e798ff0410d03121b309ad42eb0c7c'
AND (
token = 'sOdcCQ0aBlS5HDhQcusLDiISFNGwH4ltDukSCltLD48='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)