UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IGMOLnInxp+DkuBhUqHcuyqs92hMup3yAG1Pf+dbpp4='
WHERE
key_id = 'e55617b5ef35fe2b71d2edb24ccefe8a61941e12d00e4bd133d7dcf62245f549'
AND (
token = 'IGMOLnInxp+DkuBhUqHcuyqs92hMup3yAG1Pf+dbpp4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)