UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bsj9iy1OtV60sz9Zl/y9neclbSCZLRaxSdgLpA7WRpA='
WHERE
key_id = '7f1743e3ae3f72c50c3e1086f197cc3285a9b3469eddf18545feefd9d969f3c3'
AND (
token = 'bsj9iy1OtV60sz9Zl/y9neclbSCZLRaxSdgLpA7WRpA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)