UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0Bdjs8EwMFaY7TsN3ql1egc7PEuN77rsP0bCw5SRsm0='
WHERE
key_id = 'e8f482ef8771d42673197f4338305cb64059da9e6b6acffef13726546561ed46'
AND (
token = '0Bdjs8EwMFaY7TsN3ql1egc7PEuN77rsP0bCw5SRsm0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)