UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7afuxFOwrrsCs7eFdDILKWsZ5sBQa2XcxY7pxEHvYk8='
WHERE
key_id = 'ce8232946bfe6681f53bd19269ae77dd1cf10064be4f4dede092a16c8339c381'
AND (
token = '7afuxFOwrrsCs7eFdDILKWsZ5sBQa2XcxY7pxEHvYk8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)