UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zDS7eTKsnEa3pvoFnCDAvGQlqgntyaRfEfg7os6bi38='
WHERE
key_id = '522910ff1c503b2aa49ada97da46554f386f8c917e2c381e752fc354009473ee'
AND (
token = 'zDS7eTKsnEa3pvoFnCDAvGQlqgntyaRfEfg7os6bi38='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)