UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zlw7NrGVjowI/ntVj5Bvdluw0WkFJNaWJf7kjIIBIbk='
WHERE
key_id = '8e2904c5c698080768a42cec79688bddf69c2bb380d00f4db5d1c2cccbafca51'
AND (
token = 'zlw7NrGVjowI/ntVj5Bvdluw0WkFJNaWJf7kjIIBIbk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)