UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'layEkirS6Ul7AZPbqPwd+Y9EaZDscTlg2u3LPFnwie0='
WHERE
key_id = '9fd17b42a5f3abc24ce787e7813013c122913109ae2946ebed930498b1525db3'
AND (
token = 'layEkirS6Ul7AZPbqPwd+Y9EaZDscTlg2u3LPFnwie0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)