UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KhoVtcFP1cuEvsQU6YV9YpV0OztGc0KgQFV4Zkfn430='
WHERE
key_id = 'd8fbc7119e545e9dcfbe9b6eb90aff722b7b048d9b9bfb0dd14211710a982a92'
AND (
token = 'KhoVtcFP1cuEvsQU6YV9YpV0OztGc0KgQFV4Zkfn430='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)